package com.lifeng;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * Created by lifeng on 2018/4/13.
 * 服务发现与注册
 */
@SpringBootApplication
@EnableDiscoveryClient
public class ZkConsumerApplication {

    public static void main(String[] args) {
        //启动时 指定profile -Dspring.profiles.active=test
        SpringApplication.run(ZkConsumerApplication.class,args);
    }

    @Bean
    @LoadBalanced //此注解就是ribbon帮我们做客户端负载均衡的
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
